package practice.创建可缓存的线程池;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MyThreadPool {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newCachedThreadPool();
        Thread thread1 = new Thread(() -> {
            System.out.println("线程一");
        });
        Thread thread2 = new Thread(() -> {
            System.out.println("线程二");
        });
        executorService.submit(thread1);
        executorService.submit(thread2);

        executorService.shutdown();
    }
}
